Class Constant

java.lang.Object
edu.uky.ai.lp.logic.Term
edu.uky.ai.lp.logic.Constant
All Implemented Interfaces:
Formula

public class Constant
extends Term
Represents a specific thing in the logical universe.
Author:
Stephen G. Ware
  • Field Summary

    Fields inherited from class edu.uky.ai.lp.logic.Term

    name
  • Constructor Summary

    Constructors 
    Constructor Description
    Constant​(java.lang.String name)
    Constructs a new constant with the given name.
  • Method Summary

    Modifier and Type Method Description
    Constant substitute​(Unifier unifier)
    Return a version of this formula with its variables replaced with the values assigned to them by a unifier.
    Unifier unify​(Formula other, Unifier unifier)
    Unify this formula with another formula, adding to a given unifier as needed to make the two expression the same.

    Methods inherited from class edu.uky.ai.lp.logic.Term

    equals, hashCode, toString

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Constant

      public Constant​(java.lang.String name)
      Constructs a new constant with the given name.
      Parameters:
      name - the name
  • Method Details

    • unify

      public Unifier unify​(Formula other, Unifier unifier)
      Description copied from interface: Formula
      Unify this formula with another formula, adding to a given unifier as needed to make the two expression the same. The unifier passed in as an argument will not be modified; the (possibly extended) unifier is be returned by this method.
      Parameters:
      other - the other logical formula to unify with
      unifier - the unifier to extend
      Returns:
      the new unifier that makes the two formulas the same, or null if they cannot unify
    • substitute

      public Constant substitute​(Unifier unifier)
      Description copied from interface: Formula
      Return a version of this formula with its variables replaced with the values assigned to them by a unifier.
      Specified by:
      substitute in interface Formula
      Specified by:
      substitute in class Term
      Parameters:
      unifier - the unifier
      Returns:
      the formula with variables replaced